<!--
*Author：COCO
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/custom/custom/Base_Stock.js此处编写
 -->
<template>
    <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
        :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
        :table="table" :extend="extend">
    </view-grid>
</template>
<script>
import extend from "@/extension/custom/custom/Base_Inventory.js";
import { ref, defineComponent } from "vue";
export default defineComponent({
    setup() {
        const table = ref({
            key: 'Stock_Id',
            footer: "Foots",
            cnName: '存货',
            name: 'custom/Base_Inventory',
            url: "/Inventory/",
            sortName: "CreateDate"
        });

        const editFormFields = ref({
            // "id": "",
            "inventoryCode": "",// 存货编码
            "inventoryName": "", // 存货名称
            "unitId": "", // 计量单位
            "specificationModel": "",// 规格型号
            "valueCodeName": "", //计价方式
            "inventoryClassName": "", // 所属类别
            "remark": "", // 备注
            "createdTime": "", // 建档日期
            "disabled": "", // 是否停用
            "process_Id": "", // 工艺路线
            "qualityDetectionInspectionPlanId": "" // 检验方案
        });

        const editFormOptions = ref([
            [
                { "title": "存货编码", "field": "inventoryCode" ,disabled: true},
                { "title": "存货名称", "required": true, "field": "inventoryName" ,disabled: true }],
            [
                { "title": "规格型号", "field": "specificationModel", "type": "text" ,disabled: true},
                { "title": "计量单位", "field": "unitId", "type": "text" ,disabled: true}],
                // { "dataKey": "unitList", "data": [], "title": "计量单位", "required": true, "field": "unitId", "type": "select" }],
            [
                { "title": "计价方式", "field": "valueCodeName", "type": "text", disabled: true},
                { "title": "所属类别", "field": "inventoryClassName", "type": "text", disabled: true }],
            // { "dataKey": "valueCodeName", "data": [], "title": "计价方式", "required": true, "field": "Valuation_Id", "type": "select" },
            // { "dataKey": "inventoryClassName", "data": [], "title": "所属类别", "required": true, "field": "Category_Id", "type": "select" }],
            [
                {"dataKey":"processLineList","data":[],"title":"工艺路线","required":true,"field":"process_Id","type":"select" },
                {"dataKey":"inspectionPlanList","data":[],"title":"检验方案","required":true,"field":"qualityDetectionInspectionPlanId","type":"select" },
            ],
            [
                { "title": "建档日期", "field": "createdTime", "type": "datetime", disabled: true },
                { "title": "备注", "field": "remark", "type": "text", disabled: true },
            ],
            [
                { dataKey: "enable", data: [], title: "是否停用", field: "disabled", type: "radio", required: true, disabled: true }
            ]
            ]);




        const searchFormFields = ref({
            "inventoryCode": "",
            "inventoryName": "",
            "unitId": "",
            "specificationModel": "",
            "valueCodeName": "",
            "inventoryClassName": "",
            "remark": "",
            "createdTime": "",
            "disabled": ""
        });

        const searchFormOptions = ref([
            [
                { "title": "存货编码", "field": "inventoryCode" },
                { "title": "存货名称", "required": true, "field": "inventoryName" }],
            [
                { "title": "规格型号", "field": "specificationModel", "type": "text" },
                { "dataKey": "unitList", "data": [], "title": "计量单位", "required": true, "field": "unitId", "type": "select" }],
            [
                { "dataKey": "processLineNameList", "data": [], "title": "计价方式", "required": true, "field": "Valuation_Id", "type": "select" },
                { "dataKey": "inventoryClassName", "data": [], "title": "所属类别", "required": true, "field": "Category_Id", "type": "select" }],
            [
                { "title": "建档日期", "field": "createdTime", "type": "datetime" }],

            [
                { "title": "备注", "field": "remark", "type": "text" },
                { dataKey: "enable", data: [], title: "是否停用", field: "disabled", type: "radio", required: true }
            ]]);

        const columns = ref([
            { field: 'id', title: '存货定义主键ID', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' },
            { field: 'inventoryCode', title: '存货编码或名称', type: 'string', sort: true, width: 120, align: 'left' },
            { field: 'inventoryName', title: '存货名称', link: true, type: 'string', sort: true, width: 120, require: true, align: 'left' },
            { field: 'unitName', title: '计量单位', type: 'int', bind: { key: 'unitList', data: [] }, width: 70, require: true, align: 'left' },
            { field: 'specificationModel', title: '规格型号', type: 'text', width: 150, align: 'left' },
            { field: 'valueCodeName', title: '计价方式', type: 'string', bind: { key: 'productAttr', data: [] }, width: 100, require: true, align: 'left' },
            { field: 'inventoryClassName', title: '所属类别', type: 'string', bind: { key: 'processLineList', data: [] }, width: 110, require: true, align: 'left' },
            { field: 'remark', title: '备注', type: 'String', width: 110, align: 'left' },
            { field: 'createdTime', title: '建档日期', type: 'datetime', width: 130, align: 'left' },
            { field: 'disabled', title: '是否停用', type: 'boolean', bind: { key: 'enable', data: [] }, width: 80, require: true, align: 'left', formatter: (row, column, value) => { return value ? "是" : "否"; } }
        ]);

        const detail = ref({
            cnName: "#detailCnName",
            table: "#detailTable",
            columns: [],
            sortName: "",
            key: ""
        });
        return {
            table,
            extend,
            editFormFields,
            editFormOptions,
            searchFormFields,
            searchFormOptions,
            columns,
            detail,
        };
    },
});
</script>
